Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure indentation is consistent #4312

Closed
wants to merge 1 commit into from

Conversation

eelco
Copy link
Contributor

@eelco eelco commented Sep 20, 2016

This is a follow up of #4303, but takes more or less the opposite approach:

This is a proposal to make the parser more strict, and ensure that indentation always matches the literal indentation that came before it.

It makes this code not parse anymore:

new Layer
 x: 0
    y: 1

(2nd line uses a space, 3rd line a tab, this is currently legal code.)

This prevents using a different style of indentation (e.g. mixing spaces and tabs) in the same ‘block’ of code (where indentation > 0).

Mixing is still allowed if each line uses the same mix and if the indentation level returns to 0. (Each block can use it own style.)

(Breaks the literate coffeescript test that mixes spaces and tabs.)

This prevents mixing spaces and tabs in the same ‘block’ of code.

Mixing is still allowed if each line uses the same mix and if the indentation level returns to 0.

This breaks the literate coffeescript test that mixes spaces and tabs.
@eelco
Copy link
Contributor Author

eelco commented Sep 20, 2016

Also see the follow-up #4313, which is a even more strict (and IMHO better) proposal to prevent (accidental) whitespace mixing.

@eelco eelco changed the base branch from master to 2 September 21, 2016 08:19
@jashkenas
Copy link
Owner

Cool. If we're going to consider this, we should consider the strict version of it. Closing in favor of #4313.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants